<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象</title>
</head>
<body>
    <p id="demo"></p>
    <script>
        var person = {
            name:"张三",
            age:20,
            sex:"男",
            id: 1,
            fullname:function(){
                return this.name + " " + this.age + " " + this.sex;
            }
        }
        var person1=new Object();
        person1.name="李四";
        person1.age=21;
        document.write(person1.name);
        document.write("<br>");
        document.write(person1['age']);
        document.getElementById("demo").innerHTML = person.fullname();
    </script>
</body>
</html>